<?php
/** 
 * Copyright (c) 2012, Jiehun.com.cn Inc. All Rights Reserved
 * @author Ronnie(dengxiaolong@jiehun.com.cn)
 * @date 2012-2-23
 * @version 1.0 
 * @brief 文件戳，用来根据文件内容生成一个对应的标识
 *  
 **/
final class FileStamp
{
	/**
	 * 获取一个文件的戳
	 * @param string $path 文件路径
	 * @return string
	 */
	static function getStamp($path)
	{
		if (!is_file($path)) {
			throw new Exception('fileStamp.fileNotExists path='.$path);
		}
		$md5 = md5_file($path, true);
		$low = substr($md5, 3, 4);
		$high = substr($md5, 11, 4);
		$sign = $low ^ $high;
		return bin2hex ( $sign );
	}
}